//
//  UIConstanstDefine.h
//  UEHtml-iOS
//
//  Created by ShadowKnight on 13-9-28.
//  Copyright (c) 2013年 Qun He. All rights reserved.
//

#ifndef UEHtml_iOS_UIConstanstDefine_h
#define UEHtml_iOS_UIConstanstDefine_h

/*****************************--General UI define--***************************************/
#define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
// Color with Hex-data: ex. [UIColor colorWithHex:0xff00ff];
//#define HEXCOLOR(a)   [UIColor colorWithHex:(a)]
#define HEXCOLOR(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define HSVCOLOR(h,s,v) [UIColor colorWithHue:(h) saturation:(s) value:(v) alpha:1]
#define HSVACOLOR(h,s,v,a) [UIColor colorWithHue:(h) saturation:(s) value:(v) alpha:(a)]

#define IMAGENAEM(Value) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:NSLocalizedString(Value, nil) ofType:nil]]
#define IMAGE_BY_NAMED(value) [UIImage imageNamed:NSLocalizedString((value), nil)]

#define APP_SCREENRECT      [[UIScreen mainScreen] applicationFrame]
#define APP_SCREENRECT_WIDTH      [[UIScreen mainScreen] applicationFrame].size.width
#define APP_SCREEN_HEIGHT    [[UIScreen mainScreen] applicationFrame].size.height
/*****************************--Other Views define--***************************************/
//------All restaurant UIViewcontroller-----<Begin>-//
#define SYS_STATUS_BAR_HEIGHT 20
#define NAVIGATION_BAR_HEIGHT   44
#define BOTTOMBAR_HEIGHT    42

#define UE_NORMAL_VIEW_FRAME CGRectMake(0, 0, APP_SCREENRECT_WIDTH, APP_SCREEN_HEIGHT-NAVIGATION_BAR_HEIGHT)

//**************** Constant of HomeView **************--[Begin]--**//
#define CASECELL_DISTANCE_OF_ICON 40
#define CASECELL_WIDTH_OF_COUNT_LABEL 21
#define CASECELL_WIDTH_OF_ICON 21
//**************** Constant of HomeView **************--[End]--**//

#define CASECELL_FONTCOLOR_COUNT_DESC RGBCOLOR(83, 83, 83)

static UIImage* createImageWithColor(UIColor *color)
{
    CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    return theImage;
}

#endif
